#include "canvas_impl.h"

namespace visgrph
{

void canvas_impl::clear(color c)
{
	if (NULL == m_target)
		return;

	agg::rgba8 _c(c.red(), c.green(), c.blue());
	m_rmc.clear(_c);
}

void canvas_impl::rectangle(uint x, uint y, uint width, uint height, color c)
{
	if (!m_target || !width || !height)
		return;

	uint end = y + height;
	agg::rgba8 _c(c.red(), c.green(), c.blue());

	if (c.alpha() != 255)
	{
		for (; y < end; ++y)
			m_rmc.blend_hline(x, y, x + width - 1, _c, c.alpha());
	}
	else
	{
		for (; y < end; ++y)
			m_rmc.copy_hline(x, y, x + width - 1, _c);
	}
}

}; // namespace visgrph
/* EOF */
